home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / FRUITS.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  913b  |  32 lines

  1. ' FRUITS.BAS
  2. ' This program uses the PRINT# USING statement to send three lines
  3. '   of formatted fruit information to a sequential file.
  4.  
  5. OPEN "FRUITS.TXT" FOR OUTPUT AS #1  ' open file in current drive/dir
  6.  
  7. CLS
  8.  
  9. ' create a formatting template for the PRINT# USING statement
  10.  
  11. tmp$ = "Fruit:  \             \ Cases: ###    Price/pound:$$##.##"
  12.  
  13. ' get some fruit information from the user and write it to the open file
  14.  
  15. INPUT "Enter your favorite summer fruit:  ", fruit$
  16. INPUT "How many cases would you like to purchase?  ", cases%
  17. INPUT "How much does it cost per pound?  $", cost!
  18.  
  19. PRINT #1, USING tmp$; fruit$; cases%; cost!
  20.  
  21. ' add some literal values to the file
  22.  
  23. PRINT #1, USING tmp$; "Strawberry"; 2; 1.29
  24.  
  25. PRINT #1, USING tmp$; "Cantaloupe"; 14; .69
  26.  
  27. CLOSE #1                            ' close the file
  28.  
  29. PRINT
  30. PRINT "Information has been successfully written to FRUITS.TXT"
  31.  
  32.